package Chapter22.CollectionsMethod;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class Copy {
    public static void main(String[] args) {
        List<String> list1 = Arrays.asList("yellow", "red", "green", "blue");
        List<String> list2 = Arrays.asList("white", "black");
        // 如果源线性表长度大于目标线性表，怎会报如下异常：
        // Exception in thread "main" java.lang.IndexOutOfBoundsException: Source does not fit in dest
        // Collections.copy(list2, list1);
        Collections.copy(list1, list2);
        System.out.println(list1);
        System.out.println(list2);

        System.out.println(new String[0]);
    }
}
